<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>窗口通信 </title>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<h2>跑在自己服务器上的页面</h2>
<h2>https协议</h2>
<div id="showMessage"></div>
<script>
  const showMessage = document.getElementById('showMessage');
  //监听消息反馈
  window.addEventListener('message',function(event) {
    // if(event.origin !== 'http://scriptandstyle.com') return;
    console.log('received response:  ',event.data,event.origin,event.source);

    let para=document.createElement("p");
    let node=document.createTextNode(event.data);
    para.appendChild(node);
    showMessage.appendChild(para);
  },false);
</script>
</body>
</html>